import java.util.ArrayList;
import java.util.Collections;
import java.util.Set;

public class Java002 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<String>();
        Collections.addAll(list, "张无忌-男-15", "周芷若-女-14", "赵敏-女-13", "张强-男-20", "张三丰-男-100", "张翠山-男-40","张良-男-35","王二麻子-男-35","谢广坤-女-41","林婷-女-22","林立-女-23");
        ArrayList<String> endList = new ArrayList<String>();
        int man=3,woman=3,flag=1;//需要多少男生和女生

        for(int i=0;i<list.size();i++){
            int j=list.get(i).indexOf('-');
            String name = list.get(i).substring(0,j);
            String sex  = list.get(i).substring(j+1,j+2);
            if(sex.equals("男")&&name.length()==3&&man>0){
                endList.add(name);
                man--;
            }
            if(sex.equals("女")&&woman>0&&name.contains("林")){
                if(flag==1){
                    flag--;
                }else{
                    endList.add(name);
                    woman--;
                }
            }
        }
        for(int i=0;i<endList.size();i++){
            String name =endList.get(i);
            System.out.println(name);
        }
    }
}
